package openmind.demo.basicUsage.unit01;

/**
 * @author wangzhuangzhuang
 * @DESC: 接口定义抽象方法
 * @date 2021-12-11 16:47
 */
public class LambdaDemoInAbstractStyle {
	// 抽象功能接口
	interface Printer {
		void print(String val);
	}

	// 通过参数传递功能接口
	public void printSth(String sth, Printer printer){
		printer.print(sth);
	}

	public static void main(String[] args) {
		LambdaDemoInAbstractStyle demo = new LambdaDemoInAbstractStyle();
		String sth = " I am using a Functional interface!";
		// 实现Printer接口
		Printer printer = new Printer() {
			@Override
			public void print(String val) {
				// 控制台打印
				System.out.println(val);
			}
		};
	}
}